<br/><h1>my saved swarms</h1>
<%= start_form_tag :controller=>"swarm",:action=>"join_swarm" %>
<% if @results_bookmark.length>0 %>
<% @results_bookmark.each do |bm|%>
<br>
<%= link_to bm.swarm.title,:controller=>"swarm",:action=>"show_one",:id=>bm.swarm.url%>
|<%= link_to "remove",{:action=>"remove",:id=>bm.id},:confirm=>"Are you sure?"%>|
<%= check_box_tag "join_swarm[]",bm.swarm_id,false,:onclick =>"return clickchecked(this);"%>
<%end%>
<br/><br/><br/>
your saved swarms appear here
<br/><br/>
you can then select and join up to two swarms
<br/><br/>
so you can download from two swarms
<br/><br/>
so more new unsigned bands from two swarms
<br/><br/>
so more music choice from two swarms
<br/><br/><br/>
click start join seleceted two swarm:
<br/>
<%=submit_tag "start"%>
<%= end_form_tag %>
<script language=javascript>
function get_checked_size()
{
	var ca=document.getElementsByName("join_swarm[]");
	var con=0;
	for(var i=0;i<ca.length;++i)
	{
		if(ca[i].checked)con++;
	}
	return con;
}
function clickchecked(obj)
{
	var con=get_checked_size();
	if(con>2 && obj.checked)
	{
		alert("you can't select more than two swarms");
		obj.checked=false;
	}
	document.getElementsByName("commit")[0].disabled=(con==0);
}
document.getElementsByName("commit")[0].disabled=(get_checked_size()==0);
</script>
<%else%>
Currently, you don't have any saved swarm.<br>
Please search or choose a swarm and save it as bookmark.
<%end%>


